/**
 * Created by 余保林 on 2017/9/25.
 */
import ajax from '../ajax'

export default {
  getGoodsList (params, success, fail = null) {
    ajax.get({url: '/api/goods_specification/list', params, success, fail})
  },
  saveGoods (goods, success, fail = null) {
    const method = goods.id === 0 ? 'post' : 'put'
    ajax[method]({url: `/api/goods_specification/${goods.id}`, data: goods, success, fail})
  },
  deleteGoods (id, success, fail = null) {
    ajax.del({url: `/api/goods_specification/${id}`, success, fail})
  },
  deleteGoodsList (ids, success, fail = null) {
    ajax.del({url: `/api/goods_specification/deleteList`, data: {ids}, success, fail})
  },
  saleGoods (data, success, fail = null) {
    ajax.post({url: '/api/goods_specification/sale', data, success, fail})
  }
}
